package com.alex;

import com.alex.config.AppConfig;
import com.alex.pojo.User;
import com.alex.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Application {

    public static void main(String[] args) {
        ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);

        User user = ctx.getBean("user", User.class);
        System.out.println(user);

        System.out.println(ctx.getBean("userService"));
//        System.out.println(ctx.getBean("lucy"));
        System.out.println(ctx.getBean("alex"));
        UserService userService = ctx.getBean("userService", UserService.class);
        userService.show();
    }
}
